package com.xbb.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import com.xbb.entity.Statistics;
import com.xbb.mapper.ServicesMapper;
import com.xbb.entity.Services;
import com.xbb.service.ServicesService;
import org.springframework.stereotype.Service;

@Service
public class ServicesServiceImpl implements ServicesService {

    @Resource
    private ServicesMapper servicesMapper;

    // 删除数据
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return servicesMapper.deleteByPrimaryKey(id);
    }

    // 插入数据
    @Override
    public int insert(Services services) {
        return servicesMapper.insert(services);
    }

    // 插入数据
    @Override
    public int insertSelective(Services services) {
        return servicesMapper.insertSelective(services);
    }

    // 根据ID查询单个数据
    @Override
    public Services selectByPrimaryKey(Integer id) {
        return servicesMapper.selectByPrimaryKey(id);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKeySelective(Services services) {
        return servicesMapper.updateByPrimaryKeySelective(services);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKey(Services services) {
        return servicesMapper.updateByPrimaryKey(services);
    }

    // 根据条件查询分页数据
    @Override
    public List<Services> selectListByPaging(Integer page, Integer limit,Integer servicesTypeId, String name, Integer userId, Boolean status) {
        return servicesMapper.selectListByPaging(
            (page - 1) * limit,
            limit,
            servicesTypeId,
            name,
            userId,
            status
        );
    }

    // 根据条件查询数据条数
    @Override
    public int selectCountByPaging(Integer servicesTypeId, String name, Integer userId, Boolean status) {
        return servicesMapper.selectCountByPaging(
            servicesTypeId,
            name,
            userId,
            status
        );
    }

    // 查询全部数据
    @Override
    public List<Services> selectAll() {
        return servicesMapper.selectAll();
    }

    // 根据条件查询列表数据
    @Override
    public List<Services> selectList(Services services) {
        return servicesMapper.selectList(services);
    }

    // 根据字段、排序方式、limit条 查询列表数据
    @Override
    public List<Services> selectListByLimit(String field, String sort, Integer limit) {
        return servicesMapper.selectListByLimit(field, sort, limit);
    }

    // 根据字段查询列表数据
    @Override
    public List<Services> selectListByField(String field, Object value) {
        return servicesMapper.selectListByField(field, value);
    }

    // 根据条件查询单个数据
    @Override
    public Services selectOne(Services services) {
        return servicesMapper.selectOne(services);
    }

    // 根据ID查询详情数据
    @Override
    public Services selectOneByDetails(Integer id) {
        return servicesMapper.selectOneByDetails(id);
    }

    // 查询全部条数
    @Override
    public int selectAllCount() {
        return servicesMapper.selectAllCount();
    }

    // 根据条件查询数据条数
    @Override
    public int selectCount(Services services) {
        return servicesMapper.selectCount(services);
    }

    // 根据条件修改全部数据
    @Override
    public int updateAll(Services services) {
        return servicesMapper.updateAll(services);
    }

    @Override
    public List<Statistics> selectStatisticsByCategory() {
        return servicesMapper.selectStatisticsByCategory();
    }
}
